package org.lyd.spring.aop.proxy.statics;

import org.lyd.spring.aop.calculator.Calculator;

/**
 * @Author:lyd
 * 静态代理演示
 **/
public class CalculatorStaticProxy implements Calculator {
    // 被代理对象
    private Calculator calculator;

    public CalculatorStaticProxy(Calculator calculator) {
        this.calculator = calculator;
    }

    @Override
    public int add(int i, int j) {
        System.out.println("[日志]开始--> add(),参数："+i+","+j);
        int result= calculator.add(i, j);
        System.out.println("[日志]结束--> add(),结果："+result);
        return result;
    }

    @Override
    public int sub(int i, int j) {
        return 0;
    }

    @Override
    public int mul(int i, int j) {
        return 0;
    }

    @Override
    public int div(int i, int j) {
        return 0;
    }
}
